package com.yjhb.android.sbz.mvp.comment

import com.yjhb.android.sbz.entity.Comment
import com.yjhb.android.sbz.http.HttpObserver
import com.yjhb.android.sbz.http.HttpTool
import com.yjhb.android.sbz.mvp.ConventionPresenter2
import com.jojo.android.zxlib.tool.ZxLogTool


/**
 *  创建者 zx
 *  创建时间 2021/3/23 16:13
 */
class LoadCommentPresenter(loadCommentView: LoadCommentView)
    : ConventionPresenter2<LoadCommentView>(loadCommentView) {


    /**
     * 评论
     *
     * @param taskId
     * @param size
     * @param current
     */
    fun commentList(taskId: String?, size: Int, current: Int) {
        HttpTool.request(model.commentList(taskId, size, current), object : HttpObserver<List<Comment>?>() {
            override fun onResult(data: List<Comment>?) {
                view?.onLoad(data,current == 1)
            }

            override fun onError(code: Int, msg: String) {
                ZxLogTool.e(msg)
            }


        })
    }


}